#include<iostream>

using namespace std;

int n,m,upper,lower,temp,count;
float maxPoint=0.0,point;
int main(int argc, char const *argv[])
{
    scanf("%d%d",&n,&m);
    while (n--)
    {
        upper = 0;lower = 10,count = 0;
        for (int i = 0; i < m; i++)
        {
            scanf("%d",&temp);
            upper = upper>temp? upper:temp;
            lower = lower<temp? lower:temp;
            count += temp;
        }
        point = (float)(count-upper-lower)/(float)(m-2);
        maxPoint = maxPoint > point? maxPoint:point;
    }
    printf("%.2f",maxPoint);
    return 0;
}
